﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataFrameworkAccess.Entity;
using System.Data;
using Xinkui.Common.Enum;
using Xinkui.Common.FileAction;

namespace Back.Xinkui.Entity.Advert
{
    public class AdvertSpaceEntity
    {
        [DataMapping("ID", DbType.Int32)]
        public int ID { get; set; }

        [DataMapping("BoardID", DbType.Int32)]
        public int BoardID { get; set; }

        [DataMapping("SpaceNo", DbType.String)]
        public string SpaceNo { set; get; }

        [DataMapping("SpaceName", DbType.String)]
        public string SpaceName { set; get; }

        /// <summary>
        /// 广告上线
        /// </summary>
        [DataMapping("MaxCount", DbType.Int32)]
        public int MaxCount { get; set; }

        /// <summary>
        /// 有效广告数
        /// </summary>
        [DataMapping("EffectiveCounts", DbType.Int32)]
        public int EffectiveCounts { get; set; }

        [DataMapping("SourceType", DbType.Int32)]
        public int SourceType { get; set; }

        [DataMapping("SpaceType", DbType.Int32)]
        public int SpaceType { get; set; }

        [DataMapping("Width", DbType.Int32)]
        public int Width { get; set; }

        [DataMapping("Height", DbType.Int32)]
        public int Height { get; set; }

        [DataMapping("Url", DbType.String)]
        public string Url { set; get; }

        [DataMapping("Code", DbType.String)]
        public string Code { set; get; }

        [DataMapping("ImageSrc", DbType.String)]
        public string ImageSrc { set; get; }

        [DataMapping("AuditStatus", DbType.Int32)]
        public int AuditStatus { get; set; }

        [DataMapping("Description", DbType.String)]
        public string Description { set; get; }

        [DataMapping("CreateUser", DbType.String)]
        public string CreateUser { set; get; }

        [DataMapping("UpdateUser", DbType.String)]
        public string UpdateUser { set; get; }

        [DataMapping("CreateDate", DbType.DateTime)]
        public DateTime CreateDate { set; get; }

        [DataMapping("UpdateDate", DbType.DateTime)]
        public DateTime UpdateDate { set; get; }

        [DataMapping("SizeType", DbType.Int32)]
        public int SizeType { get; set; }

        [DataMapping("BWidth", DbType.Int32)]
        public int BWidth { get; set; }

        [DataMapping("BHeight", DbType.Int32)]
        public int BHeight { get; set; }

        public string viewImage
        {
            get
            {
                string certImg = FileFactory.BrowerFile(ImageSrc, ESourceType.SpacePic, 0, 0);
                return string.IsNullOrEmpty(certImg) ? "/Themes/default/images/Img/noimage.jpg" : certImg;
            }
        }

    }
}
